package org.rslai.tcedit.web.core;

import org.apache.commons.logging.*;
import org.springframework.web.servlet.mvc.Controller;
import org.rslai.tcedit.business.*;

/**
 * Super class used for init log and service objects. DONOT extends this class 
 * directly. Extends from AbstractMVCController, AbstractRedirectController, 
 * AbstractScriptController and AbstractXmlController.
 * 
 * @author xuefeng
 */
public abstract class AbstractBaseController implements Controller {

    protected Log log;

    protected RoleService roleService;
    protected UserService userService;
	protected CaseStateService caseStateService;
	protected ExecuteStateService executeStateService;
	protected ProductService productService;
	protected ProductUserService productUserService;
	protected VersionService versionService;
	protected CatalogService catalogService;
	protected TestCaseService testCaseService;

	protected SearchService searchService;
    protected MailService mailService;

    public AbstractBaseController() {
        log = LogFactory.getLog(this.getClass());
        log.info("Init controller: " + this.getClass().getName());
    }

	/**
	 * 注入 userService 对象。所有的 User DAO 操作被封装在这个接口中。
	 * @spring.property ref="userService"
	 */
	public final void setUserService(UserService userService) {
		this.userService = userService;
	}

	/**
	 * 注入 roleService 对象。所有的 Role DAO 操作被封装在这个接口中。
	 * @spring.property ref="roleService"
	 */
	public final void setRoleService(RoleService roleService) {
		this.roleService = roleService;
	}

	/**
	 * 注入 caseStateService 对象。所有的 CaseState DAO 操作被封装在这个接口中。
	 * @spring.property ref="caseStateService"
	 */
	public final void setCaseStateService(CaseStateService caseStateService) {
		this.caseStateService = caseStateService;
	}

	/**
	 * 注入 executeStateService 对象。所有的 ExecuteStateService DAO 操作被封装在这个接口中。
	 * @spring.property ref="executeStateService"
	 */
	public final void setExecuteStateService(ExecuteStateService executeStateService) {
		this.executeStateService = executeStateService;
	}

	/**
	 * 注入 productService 对象。所有的 ProductService DAO 操作被封装在这个接口中。
	 * @spring.property ref="productService"
	 */
	public final void setProductService(ProductService productService) {
		this.productService = productService;
	}

	/**
	 * 注入 productUserService 对象。所有的 ProductUserService DAO 操作被封装在这个接口中。
	 * @spring.property ref="productUserService"
	 */
	public final void setProductUserService(ProductUserService productUserService) {
		this.productUserService = productUserService;
	}

	/**
	 * 注入 versionService 对象。所有的 versionService DAO 操作被封装在这个接口中。
	 * @spring.property ref="versionService"
	 */
	public final void setVersionService(VersionService versionService) {
		this.versionService = versionService;
	}

	/**
	 * 注入 catalogService 对象。所有的 catalogService DAO 操作被封装在这个接口中。
	 * @spring.property ref="catalogService"
	 */
	public final void setCatalogService(CatalogService catalogService) {
		this.catalogService = catalogService;
	}

	/**
	 * 注入 testCaseService 对象。所有的 testCaseService DAO 操作被封装在这个接口中。
	 * @spring.property ref="testCaseService"
	 */
	public final void setTestCaseService(TestCaseService testCaseService) {
		this.testCaseService = testCaseService;
	}

    /**
     * Inject SearchService object. All search operations are wrapped in 
     * this interface.
     * 
     * @spring.property ref="searchService"
     */
    public final void setSearchService(SearchService searchService) {
        this.searchService = searchService;
    }

    /**
     * Inject MailService object. Sub-class can use it to send mails.
     * 
     * @spring.property ref="mailService"
     */
    public final void setMailService(MailService mailService) {
        this.mailService = mailService;
    }

}
